Component({
  data: {
    selected: 0,
    color: "#ffffff",
    selectedColor: "#bebcb9",
    list: [{
      pagePath: "/pages/index/index",
      iconPath: "../img/index.png",
      selectedIconPath: "../img/index-y.png",
      text: "首页"
    }, {
      pagePath: "/pages/classify/classify",
      iconPath: "../img/classify.png",
      selectedIconPath: "../img/classify-y.png",
      text: "分类"
    }, {
      pagePath: "/pages/shoppingcar/shoppingcar",
      iconPath: "../img/shoppingcar.png",
      selectedIconPath: "../img/shoppingcar-y.png",
      text: "购物车"
    }, {
      pagePath: "/pages/user/user",
      iconPath: "../img/user.png",
      selectedIconPath: "../img/user-y.png",
      text: "我"
    }]
  },
  attached() {
  },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({ url })
      this.setData({
        selected: data.index
      })
    }
  }
})